//
//  ZWHomeTitleView.swift
//  张伟的微博
//
//  Created by 伟 on 16/3/2.
//  Copyright © 2016年 伟. All rights reserved.
//

import UIKit


class ZWHomeTitleView :UIButton{
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        titleLabel?.frame.origin.x = 0
        imageView?.frame.origin.x = titleLabel!.frame.width + 5
    }
    
    //便利构造函数
    init(titleName: String) {
        super.init(frame: CGRectZero)
        setTitle(titleName, forState: UIControlState.Normal)
        setImage(UIImage(named: "navigationbar_arrow_down"), forState: UIControlState.Normal)
        setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        //添加按钮点击效果
        
        sizeToFit()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
     }